//api文件夹用于存放对后台请求的代码
import service from ".";//导入
import qs from 'qs'

const userApi = {
    reg(user){
        return service.post("/user/reg",qs.stringify(user));
    },
    login(user) {
        return service.post("/user/login",qs.stringify(user));
    },
    captcha(){
        return service.get('/user/captcha');
    },
    //获取已登录用户的信息
    getInfo(){
      return service.get('/user/info')
    },
    delete(id) {
        return service.delete(`/user/${id}`);
    },
    update(user) {
        return service.put("/user/update", user);
    },
    //修改登录密码
    changePwd(changePassword){
        return service.put("/user/changePwd", qs.stringify(changePassword));
    },
    //修改支付密码
    changePwd1(changePassword){
        return service.put("/user/changePwd1", qs.stringify(changePassword));
    },
    //分页搜索
    selectByPage(condition, pageNum, pageSize) {
        condition.pageNum = pageNum;
        condition.pageSize = pageSize;
        return service.get("/user/search", {
            params: condition
        });
    },
    //根据id查询
    selectById(id) {
        return service.get(`/user/${id}`);
    },
    //重置密码
    backPwd(id){
        return service.put(`/user/${id}`);
    },
    //充值金额
    updateMoney(user) {
        return service.put("/user/updateMoney", user)
    },
};

export default userApi;//导出